<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="fm" %>

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/12/1
  Time: 20:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改界面</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script src="js/jquery-1.12.4.js" type="text/javascript"/>
    <script type="text/javascript">

        function checkName(){
            var sname = $("[name='sname']").val();
            if (sname==''||sname.length==0){
                $("[name='sname']").focus();
                alert("姓名必填");
                return false;
            }
            return true;
        }

        $(function () {
            $("myForm").submit(
                function(){
                    if (!checkName()) return false;
                    else return true;
                }
            );
        });
    </script>
</head>
<body>
<fm:form id="xxForm" action="/doUpdate" method="post" modelAttribute="old">
    <fm:hidden path="sno"/>
    姓名:<fm:input path="sname"/><br/>
    密码:<fm:input path="spass"/><br/>
    出生日期:<fm:input path="birthdate"/><br/>
    年级:
    <fm:select path="grade.gid">
        <option value="-1">请选择</option>
        <fm:options items="${gradeAll}"
                    itemLabel="gname" itemValue="gid"/>
    </fm:select>
    <input type="submit" value="提交">
</fm:form>
</body>
</html>
